package com.lzy.crm.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.lzy.crm.base.mybatis.BaseMapper;
import com.lzy.crm.base.page.PageQuery;
import com.lzy.crm.base.service.BaseServiceImpl;
import com.lzy.crm.base.util.StringUtil;
import com.lzy.crm.dao.NoticeMapper;
import com.lzy.crm.dao.criteria.NoticeCriteria;
import com.lzy.crm.domain.Notice;
import com.lzy.crm.service.NoticeService;

@Service("noticeService")
public class NoticeServiceImpl extends BaseServiceImpl<Notice,NoticeCriteria> implements NoticeService {

	
	
	
	@Resource
	private NoticeMapper noticeMapper;

	@Override
	public BaseMapper<Notice, NoticeCriteria> getBaseMapper() {
		return  noticeMapper;
	}
	
	/**
	 * 分页查询公告
	 * @param pageQuery
	 * @return
	 */
	public List<Notice> getCardFlowList(String title,PageQuery pageQuery){
		return noticeMapper.getCardFlowList(title,pageQuery);
	}
	

	/**
	 * 根据ID 查询公告信息
	 * @param id
	 * @return
	 */
	public Notice getNoticeById(String id){
		Notice notice = null ;
		if(StringUtil.isNotEmpty(id)){
			notice = noticeMapper.getById(id);
		}else{
			notice = noticeMapper.getNewNotece();
		}
		return notice;
	}
	
}
